import type {
  PostPatientConsultPayParams,
  DepartmentItem,
  GetPatientConsultOrderPreData,
  GetPatientConsultOrderPreParams,
  GetPatientConsultOrderDetailData,
  GetPatientConsultOrderListData,
  GetPatientConsultOrderListParams,
} from '@/types/consult'
import { request } from '@/utils/request'

/**
 * 医生认证--查询所有科室-层级
 * @returns 所有科室
 */
export const getDepAllAPI = () => {
  return request<DepartmentItem[]>('/dep/all', 'GET')
}

/**
 * 问诊-支付页面-计算就诊信息和抵扣信息
 * @param params 参数
 * @returns 返回数据
 */
export const getPatientConsultOrderPreAPI = (params: GetPatientConsultOrderPreParams) => {
  return request<GetPatientConsultOrderPreData>('/patient/consult/order/pre', 'GET', params)
}

/**
 * 问诊-支付页面-支付
 * @param params 参数
 * @returns 返回数据
 */
export const postPatientConsultOrderPayAPI = (params: PostPatientConsultPayParams) => {
  return request<{ payUrl: string }>('/patient/consult/pay', 'POST', params)
}
// 问诊-查询订单详情信息-找医生、极速问诊和开药问诊
// GET
// /patient/consult/order/detail
export const getPatientConsultOrderDetailAPI = (orderId: string) => {
  return request<GetPatientConsultOrderDetailData>('/patient/consult/order/detail', 'GET', {
    orderId,
  })
}
/**
 * 问诊记录-订单列表-找医生、极速问诊、开药问诊
 * @param params 参数
 * @returns 订单列表数据
 */
export const getPatientConsultOrderListAPI = (params: GetPatientConsultOrderListParams) => {
  return request<GetPatientConsultOrderListData>('/patient/consult/order/list', 'GET', params)
}
// 订单-删除订单
// DELETE
// /patient/order/{id}
export const deletePatientOrderAPI = (id: string) => {
  return request(`/patient/order/${id}`, 'DELETE')
}
// 订单-取消订单
// PUT
// /patient/order/cancel/{id}
export const cancelPatientOrderAPI = (id: string) => {
  return request(`/patient/order/cancel/${id}`, 'PUT')
}

